# $Id: PKGBUILD 183071 2013-04-17 07:11:00Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

pkgname=alsa-utils
pkgver=1.0.27
pkgrel=4
pkgdesc="An alternative implementation of Linux sound support"
arch=('i686' 'x86_64')
url="http://www.alsa-project.org"
#can not use >=$pkgver due to use of letters in alsa-lib update versioning
depends=("alsa-lib>1.0.24" 'dialog' 'pciutils' 'ncurses' 'psmisc' 'libsamplerate')
makedepends=('xmlto' 'docbook-xsl')
license=('GPL')
source=(ftp://ftp.alsa-project.org/pub/utils/$pkgname-${pkgver}.tar.bz2
        90alsa
        alsa-restore-1.0.27.service.patch
        alsactl-fix-buffer-overflow-1.0.27.patch
        arecord-1.0.27.patch)
backup=(etc/conf.d/alsa)

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -Np1 -i ${srcdir}/alsa-restore-1.0.27.service.patch
  patch -Np1 -i ${srcdir}/alsactl-fix-buffer-overflow-1.0.27.patch
  patch -Np1 -i ${srcdir}/arecord-1.0.27.patch
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr --disable-alsaconf \
    --with-udev-rules-dir=/usr/lib/udev/rules.d \
    --with-systemdsystemunitdir=/usr/lib/systemd/system
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
  install -D -m755 ../90alsa ${pkgdir}/etc/pm/sleep.d/90alsa

  # dir where to save ALSA state
  install -d ${pkgdir}/var/lib/alsa
}
md5sums=('cbfb21a24f63fb052b3392195639ce48'
         '529216f6a46e61a546640e08ea7a0879'
         '0a27f7b80351d6baa274c32d859bf037'
         'cd577445636542f9f60b420e4ffe3f0f'
         'cecb38f03bd245d0584bfd63370e9a05')
